<template>
  <div class="answer-item">
    <div class="answer-item-title" @click="jumpDateils">
      {{ questionData.content.question_title }}
    </div>
    <div
      v-if="questionData.answer!=null && questionData.answer.user!=null"
      class="answer-item-user"
    >
      <div
        class="answer-item-user-photo"
        :style="{background:'url('+questionData.answer.user.user_photo+') center center no-repeat',backgroundSize:'100% 100%'}"
      />
      <div class="answer-item-user-name">
        {{ questionData.answer.user.user_name }}
      </div>
    </div>
    <div class="answer-item-content">
      <div
        v-if="questionData.answer!=null"
        class="answer-item-content-box"
      >
        <div class="answer-item-content-icon" />
        <div class="answer-item-content-text" @click="jumpDateils">
          {{ questionData.answer.answer_content_brief }}
        </div>
      </div>
      <div class="answer-item-num">
        <div class="answer-item-browse">
          {{ questionData.browse_count }}人已经看
        </div>
        <div class="answer-item-comment">
          <div class="answer-item-comment-text">
            {{ questionData.comment_count||0 }}
          </div>
          <div class="answer-item-comment-icon" />
        </div>
        <div class="answer-item-star">
          <div class="answer-item-star-text">
            {{ questionData.star_count||0 }}
          </div>
          <div class="answer-item-star-icon" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  components: {

  },
  props: {
    questionData: {
      type: Object,
      default: () => { }
    }
  },
  data() {
    return {

    }
  },
  computed: {

  },
  created() {

  },
  mounted() {

  },
  methods: {
    jumpDateils() {
      this.$router.push(`/question/${this.questionData.content_id}`)
    }
  }
}
</script>
<style scoped lang="scss">
.answer-item-title {
  font-size: 18px;
  font-weight: 600;
  color: rgba(51, 51, 51, 1);
  line-height: 25px;
}
.answer-item-title:hover{
  cursor: pointer;
}
.answer-item-user {
  display: flex;
  margin-top: 12px;
  .answer-item-user-photo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-left: 8px;
  }
  .answer-item-user-name {
    font-size: 12px;
    font-weight: 500;
    color: rgba(102, 102, 102, 1);
    line-height: 17px;
    margin-left: 8px;
  }
}
.answer-item-content {
  .answer-item-content-box {
    display: flex;
    margin-top: 11px;
  }
  .answer-item-content-icon {
    width: 16px;
    height: 16px;
    background: url("~assets/img/answer-icon.png") center center no-repeat;
    background-size: 100% 100%;
    margin-top: 5px;
  }
  .answer-item-content-text {
    width: 605px;
    height: 42px;
    margin-left: 5px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(51, 51, 51, 1);
    line-height: 21px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .answer-item-content-text:hover{
    cursor: pointer;
  }
  .answer-item-num {
    display: flex;
    font-size: 12px;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    line-height: 17px;
    margin-top: 10px;
    margin-left: 12px;
    margin-bottom: 20px;
  }
  .answer-item-comment{
    display: flex;
    margin-left: 23px;
    .answer-item-comment-icon{
      width: 14px;
      height: 14px;
      background: url('~assets/img/comment-icon.png') center center no-repeat;
      background-size: 100% 100%;
      margin-left: 10px;
    }
  }
  .answer-item-star{
    display: flex;
    margin-left: 23px;
    .answer-item-star-icon{
      width: 14px;
      height: 14px;
      background: url('~assets/img/star-icon.png') center center no-repeat;
      background-size: 100% 100%;
      margin-left: 10px;
    }
  }
}
</style>
